package com.sunny.t1;

import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        if("".equals(str)){
            System.out.println(0);
            return;
        }

        HashMap<Character, Integer> map = new HashMap<>();

        int res = 1;
        int ind = 0;
        map.put(str.charAt(0), 0);
        for(int i=1;i<str.length();i++){
//            System.out.println(i+" "+ind);
            if(map.containsKey(str.charAt(i)) && map.get(str.charAt(i))>=ind){
                ind = map.get(str.charAt(i)) + 1;
            }else {
                if (i - ind + 1 > res) {
                    res = i - ind + 1;
                }
            }
            map.put(str.charAt(i), i);
        }

        System.out.println(res);
    }

}
